function plotasst(funct,N,D1,D2,M)
% plotasst(funct,N,D1,D2,M)
% 	Parameters:
% 		funct:	the function to use to generate a time series
% 		D1:	first displacement
% 		D2:	second displacement
% 		M:	kernel size
% 
% 	Outputs:
% 		The only output of this function are the plots described below.
% 
% 	Purpose of this code:  By turning on and off various plots the following plots can be created:
% 	Fractional error of an interpolated shift vs. an analytic shift, the fractional error of 
% 	interpolating via two shifts vs. via one shift with respect to the analytic shift, the fractional
% 	error of interpolating via two shifts vs. the analytic sift, and the fractional error of interpolating
% 	via two shifts vs. interpolating via one shift with respect to the one shift interpolation.
hold off;
%% Establish variables
D = D1 + D2;
LB = D + (M-1)./2;
LB2 = D + M;

%% Generate Mesh
x = 1:N;

%% Generate Time Series
ts = funct(x);

%% Shift Time (D1 + D2) Series Analytically
tsa = funct(x - D);

%% Shift (D1) Time Series by Interpolation
% Then shift (D2) Time Series again by Interpolation
ts1 = FDtest(ts,D1,M);
ts2 = FDtest(ts1,D2,M);


%% Shift (D1 + D2) Time Series by Interpolation
tsi = FDtest(ts,D,M);

%% Calculate Fractional Error |analytic - interpolated|/|analytic|
err(x) = abs(tsa(x)-tsi(x))./abs(tsa(x));

%% Calculate Fractional Error 
%|interpolated(2 shifts) - interpolated|/|analytic|
err2(x) = abs(ts2(x)-tsi(x))./abs(tsa(x));

%% Calculate Fractional Error 
% |analytic - interpolated(2 shifts)|/|analytic|
err3(x) = abs(tsa(x)-ts2(x))./abs(tsa(x));

%% Calculate Fractional Error
% |interpolated(2 shifts) - interpolated|/|interpolated|
err4(x) = abs(ts2(x) - tsi(x))./abs(tsi(x));
%% Plot Fractional Error wrt Time
%plot(x,err);
%semilogy(x,err);
%xlim([LB,N]);

%% Simultaniously Plot Fractional Errors wrt Time
%plot(x,err,'b');
%semilogy(x,err,'b');
%hold on;
%plot(x,err2,'r');
%semilogy(x,err2,'r');
%hold on;
%plot(x,err3,'g');
%semilogy(x,err3,'g');
%xlim([LB2,N]);

%% Plot Fractional Error wrt Time (1 Shift vs. 2 Shift)
%plot(x,err4);
semilogy(x,err4);
xlim([LB2,N]);

end
